<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn" lang="zh-cn" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Access IP List - xiaohei.me</title>
</head>
<body>

<div style="width:100%; text-align: center; margin-top: 100px;">

<?php
include dirname(__FILE__) . '/conf.php';

$user = post_str('user');
$password = post_str('password');
if ($user != 'xiaohei' && $password != 'xiaohei'){
    exit('<form action="access_ip.php" method="post"><input type="text" name="user" value="" /><input type="password" name="password" value="" /><input type="submit" value=" GO "></form>');
}

$db = db_xiaohei();
$sql = "select id, ip, area, addtime from access_ip order by id desc limit 20";
$result = $db->query($sql);

echo 
'<table border="1" cellpadding="8px" cellspacing="0" align="center">',
'<colgroup><col width="50px"><col width="150px"><col width="350px"><col width="180px"></colgroup>',
'<tbody><tr>',
'<td>id</td><td>ip</td><td>ip_area</td><td>time</td>',
'</tr>';

foreach ($result as $re){
	echo "<tr>",
    "<td>{$re['id']}</td>",
    "<td align=\"left\">", long2ip($re['ip']), "</td>",
    "<td align=\"left\">{$re['area']}</td>",
    "<td>{$re['addtime']}</td>",
    "</tr>";
}
echo '</tbody></table>';
?>

</div>

</body>
</html>